﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using CruzDelSur.Dominio.Seguridad;
using CruzDelSur.Persistencia;
using CruzDelSur.Persistencia.Seguridad;
using CruzDelSur.Models;

namespace CruzDelSur.Negocio
{
    public class SeguridadService 
    {
        /*ISeguridadDAO SeguridadDAO { get; set; }
        public SeguridadService() { }
  
        #region IMembershipService Members

        private Usuario ValidarUsuario(string userName, string password){
            Usuario user = SeguridadDAO.Obtener(userName);
            if (user != null)
            {
                if (password == user.Clave)
                    return user;
                else return null;
            }
            else
            {
                return user;
            }
        }

        int IMembershipService.MinPasswordLength
        {
            get { return 3; }
        }

        public override int MaxInvalidPasswordAttempts
        {
            get { return 3; }
        }

        public override int MinRequiredNonAlphanumericCharacters
        {
            get { return 1; }
        }

        public override int MinRequiredPasswordLength
        {
            get { return 3; }
        }

        bool IMembershipService.ValidateUser(string userName, string password)
        {
            return ValidarUsuario(userName, password) != null;
        }

        System.Web.Security.MembershipCreateStatus IMembershipService.CreateUser(string userName, string password, string email)
        {
            throw new NotImplementedException();
        }

        public override bool ChangePassword(string userName, string oldPassword, string newPassword)
        {
            Usuario user = ValidarUsuario(userName, oldPassword);
            if (user != null)
            {
                user.Clave = newPassword;
                SeguridadDAO.Modificar(user);
                return true;
            }
            else
            {
                return false;
            }
        }

        #endregion*/
    }
}